package com.designprinciple.test;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * @Description
 * @Author Ping
 * @Date 2022/3/7 11:30
 **/
@Component
public class ClassExample {

    private List<InterfaceExample> intList ;


    private InterfaceExample interfaceExample ;

    public void injectMethod(String clsName) {
        try {
            Class<?> cls = Class.forName(clsName) ;
            this.interfaceExample = (InterfaceExample) cls.newInstance() ;
        } catch (Exception e) {

        }
    }
    public List<InterfaceExample> getIntList() {
        return intList;
    }

    public InterfaceExample getInterfaceExample() {
        return interfaceExample;
    }

    @Autowired
    public void setIntList(List<InterfaceExample> intList) {
        this.intList = intList;
    }
}
